<form method="POST" name="form_admin" action="<?php echo formEditAction()?>" onsubmit="return CheckForm(this)">
<input type="hidden" name="id" value="<?echo $id?>" />
<table width="100%" cellpadding="0" cellspacing="0" id="tbledit">
    <tr>
		<td height="10"></td>
	</tr>
	
	<tr>
        <td width="150"><b><span class="style1"><?echo getLang('Url')?></span></b></td>
        <td style="font-weight: 600;">
            <input class="normal3" type="text" name="URL" id="URL" value="<?php echo $content["cUrlString"]; ?>" />
            &nbsp;&nbsp;
            <?php echo CheckBoolean('isNew',$content['iNew'])?> <label for="isNew"><?php echo getLang('is New')?></label>
            &nbsp;&nbsp;
            <?php echo CheckBoolean('isHot',$content['iHot'])?>  <label for="isHot"><?php echo getLang('is Hot')?></label>
	   </td>
    </tr>
	
	<tr>
      <td><span class="style1"><b><?echo getLang('Name')?></b></span></td>
	  <td>	
	  	<input class="normal3" type="text" name="Name" id="Name" value="<?php echo $content["cName"]?>" />  
          &nbsp;&nbsp;&nbsp;
          <span class="style1">Product Code</span>  
          	<input type="text" name="Code" id="Code" class="normal0" value="<?echo $content['cCode']?>" />        
	  </td>
    </tr>
	
	<?
	if($hasTag)
	{
	?>
	<tr>
      <td><b><?echo _TAGS?></b></td >
	  <td><input type="text" id="Tag" name="Tag" value="<?php echo $content["cTag"]?>" /></td>
    </tr>
	<?
	}
	?>
	
	<tr>
      <td><b>Category</b></td>
	  <td>
	  	<select name="Category" id="Category" style="width:200px" onchange="changecategory(this)">
          <?echo ListOptionParentProduct($content["iParentId"])?>
        </select>     
		</td>
    </tr>	
	<?/*
	<tr>
      <td><b><?echo getLang('Trade')?></b></td>
	  <td>
	  	<select name="Trade" id="Trade"  style="width:200px">
          	<?php echo ListOptionTrade($content['iTradeId'])?>
        </select>      </td>
    </tr>
	*/?>
	<tr>
      <td><b><?echo getLang('Warranty')?></b></td>
	  <td>
	  		<input type="text" class="normal1" name="Warranty" value="<?echo $content['cWarranty']?>" /> <?echo getLang('Month')?>
            &nbsp;&nbsp;
            <b><?echo getLang('Promotion')?></b>
            <input type="text" class="normal1" name="Promotion" value="<?echo $content['cPromotion']?>"  /> (Option)
	  </td>
    </tr>
		
	<tr>
      <td><b><?echo getLang('Price')?></b></td>
	  <td>
	  		<input type="text" class="normal1" name="Price" value="<?echo $content['cPrice']?>" style="text-align: right;"  /> 
            <?echo getconfig("UnitInput")?>
            
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <b><?echo getLang('Price old')?></b>
            <input type="text" class="normal1" name="PriceOld" value="<?echo $content['cPriceOld']?>" style="text-align: right;"  /> 
            <?echo getconfig("UnitInput")?>
	  </td>
    </tr>
    
	<tr>
      <td><b><?echo getLang('Intro Image')?></b></td>
	  <td>
	  	<?php echo inputFile('ImgIntro',$content["cImage"])?>
		</td>
    </tr>
	
	 <?php
	if(HAS_BANNER==true)
	{
	?>
    <tr>
        <td><b><?php echo _BANNERIMAGE?></b></td>
      <td>
            <?php echo inputFile('ImgBanner',$content["cBanner"],'banner')?>
		</td>
    </tr>
    <?php
	}
	?>
    
    <?php
	if(HAS_BACKGROUND==true)
	{
	?>
    <tr>
        <td><b>Background Image</b></td>
        <td>
            <?php echo inputFile('ImgBackground',$content["cBackground"],'background')?>
        </td>
    </tr>
    <?php
	}
	?>
	
	<tr>
      <td valign="top"><b>Status</b></td>
	  <td>		
        <select name="Status" id="Status">
          <?php echo liststatus($content["iStatus"]) ?>
        </select>
        
        &nbsp;&nbsp;
        <b><?echo getLang('Depository')?></b>
        
        <select name="Depository" id="Depository">
          <?php echo liststatus($content["iDepository"]) ?>
        </select>
      </td>
    </tr>
	
     <tr>
        <td valign="top" style="vertical-align:top">
			<b><?php echo getLang('Detail description')?></b>
		</td>
        <td><textarea style="height:300px; width:90%;" name="Content" class="tinymce"
				id="Content"><?php echo $content["cContent"]; ?></textarea></td>
    </tr>
	
	 <tr>
        <td valign="top" style="vertical-align:top"><b><?php echo getLang('Properties')?></b>
        <div>[ <a style="cursor:pointer" onclick="loadTable('Description')">Add Table Property</a>] </div></td>
        <td style="padding-bottom:10">
		<textarea style="height:100px; width:90%;" name="Description" id="Description"><?php echo $content["cDescription"]?></textarea></td>
    </tr>
	
	<tr>
		<td colspan="2">
		
		<fieldset>
		<legend><?php echo getLang('Properties')?></legend>
		<?
		if(count($properties)==0)
		{
			echo "<div style='color:#ff0000'><strong>Not found Properties. <a href='?opt=property&id=$idP'>Please Click here to add Property</a></strong></div>";
		}
		?>
		<table width="100%" cellpadding="0" cellspacing="0">		
		<?
		foreach($properties as $i => $field)
		{
		?>
			
			<tr>
			  <td width="150" class="pl10"><b title="<?echo $field[2]?>" ><?echo $field[1]?></b></td>
			  <td>
					<input type="text" class="normal3" style="width:50%" title="<?echo $field[2]?>" 
					name="property_<?echo $field[0]?>" value="<?echo $field[3]?>" />
			  </td>
			</tr> 
		<?
		}
		?>		
		</table>
		</fieldset>
		</td>
	</tr>



	<tr>
		<td><b>Filters</b></td>
		<td  style="padding-bottom:5px">		
		<table>
		<tr>
		<?
		$u=1;
        if(!is_array($filters))
        {
            $filters    = array();
        }
		foreach($filters as $i => $filter)
		{
			if($filter['cValue']=="Price")continue;
		?>
			<td><strong><?echo $filter['cName']?></strong></td>
			<td style="padding-right:15px">
				<select name="filters[]" style="width:180px">
					<?echo ListOptionFilterValue($filter['iId'],$id)?>
				</select>
			</td>
		<?
		if($u%4==0 && $u>1)echo '</tr><tr>';
		$u++;
		}
		?>
		</tr>
		</table>
		</td>
	</tr>
	
	<tr>
		<td><b><?echo getLang('Meta Title')?></b></td>
		<td>
			<input class="normal3" style="width:90%" type="text" name="MetaTitle" id="MetaTitle" value="<?php echo $content["cMetaTitle"]; ?>" />        </td>
	</tr>
	
	<tr>
		<td><b><?echo getLang('Meta keywords')?></b></td>
		<td>
			<input class="normal3" style="width:90%" type="text" name="MetaKeywords" id="MetaKeywords" 
			value="<?php echo $content["cMetaKeywords"]; ?>" />        
		</td>
	</tr>
	
	<tr>
		<td><b><?echo getLang('Meta descriptions')?></b></td >
		<td style="padding-bottom:10">
		<textarea style="height:70px; width:90%;"  name="MetaDescription" class="noeditor"  
		id="MetaDescription"><?php echo $content["cMetaDescription"]; ?></textarea></td>
	</tr>
		
    <tr>
        <td colspan="2">&nbsp;</td>                       
    </tr>
</table>
</form>
<script language="javascript" type="text/javascript">
function CheckForm(f)
{
	if(f.URL.value=="")
	{
	   f.URL.value=f.Name.value;
	}
	if(f.Name.value=="")
	{
		alert("please enter name");
		return false;
	}
	return AIM.submit(f,null,true);
}
var ajaxloadpro=new ajaxLoader;
ajaxloadpro.init({url:location.href,func:addTable,cache:true})
function loadTable()
{
    id      = document.getElementById('Category').value;
    ajaxloadpro.send('idP='+id);
}

function addTable(obj)
{
	tinymce.EditorManager.activeEditor.execCommand('mceInsertContent',false,obj);
}

function changecategory(se)
{
    url =location.href;
    if(url.indexOf('idP')==-1)
    {
        url+="&idP="+se.value;
    }
    location.href=url.replace(/idP=.*/,'idP='+se.value);
}
</script>